import request from '../utils/request'


// 用户相关接口
export const userApi = {
    // 登录
    login: (data) => request({
        url: '/user/user/login',
        method: 'post',
        data
    }),
    // 发送验证码
    sendCode: (data) => request({
        url: '/user/user/sendCode',
        method: 'post',
        data
    }),
    // 注册
    register: (data) => request({
        url: '/user/user/register',
        method: 'post',
        data
    }),
    // 修改密码
    updatePassword: (data) => request({
        url: '/user/user/password',
        method: 'put',
        data
    }),
    // 重置密码
    resetPassword: (id, data) => request({
        url: '/user/user/' + id + '/password/reset',
        method: 'put',
        data
    }),
    //修改用户状态
    updateStatus: (data) => request({
        url: `/user/user/status`,
        method: "put",
        data
    }),
    // 获取用户列表
    getUserList: (data) => request({
        url: '/user/user/page',
        method: 'post',
        data
    }),
    // 登出
    logout: () => request({
        url: '/user/user/logout',
        method: 'get',
    }),
    // 修改用户信息
    updateUser: (data) => request({
        url: `/user/user/updateUser`,
        method: "put",
        data
    }),// 修改用户信息
    addUser: (data) => request({
        url: `/user/user/addUser`,
        method: "post",
        data
    }),
    // 获取当前用户信息
    getCurrentUser: () => request({
        url: '/user/user/current',
        method: 'get'
    }),
    
    // 更新当前用户信息
    updateCurrentUser: (data) => request({
        url: '/user/user/current',
        method: 'put',
        data
    }),
}
